﻿<%@ Page Title="" Language="VB" MasterPageFile="~/App/Master/App.master" AutoEventWireup="false" CodeFile="Dashboard.aspx.vb" Inherits="App_Dashboard" %>

<%@ Register Src="~/App/Controls/PrivateMessage.ascx" TagPrefix="App" TagName="PrivateMessage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphMainContent" runat="Server">
    <asp:ScriptManagerProxy runat="server">
        <Scripts>
            <asp:ScriptReference Path="https://www.google.com/jsapi" />
            <asp:ScriptReference Path="Dashboard.aspx.js" />
        </Scripts>
    </asp:ScriptManagerProxy>

    <!-- console -->
    <div class="alert">
        <asp:UpdatePanel ID="UpPConsole" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <table>
                    <tr>
                        <td>
                            <div id="calendario">
                                <asp:Label runat="server" ID="LblReportDate"></asp:Label>
                            </div>
                        </td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay15" Text="15" CommandName="CONSOLE_DAY" CommandArgument="15" />
                        </td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay30" Text="30" CommandName="CONSOLE_DAY" CommandArgument="30" /></td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay60" Text="60" CommandName="CONSOLE_DAY" CommandArgument="60" /></td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay90" Text="90" CommandName="CONSOLE_DAY" CommandArgument="90" /></td>
                        <td>
                            <a href="#" class="a-icona5" id="calendar_view"></a>
                        </td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count-s" ID="RbtDaily" Text="d" CommandName="CONSOLE_GROUP" CommandArgument="d" /></td>
                        <td>
                            <asp:LinkButton runat="server" CssClass="pg-count-s" ID="Rbtweekly" Text="w" CommandName="CONSOLE_GROUP" CommandArgument="w" /></td>
                        <td>
                            <asp:LinkButton runat="server" ID="BtnExport" CssClass="xls-export" Text="xls export" /></td>
                    </tr>
                </table>
                <div id="calendar-frame">
                    <table>
                        <tbody>
                            <tr>
                                <td>
                                    <label for="from">From</label>
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="TxtBeginDate" CssClass="pull-right"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <label for="to">to</label>
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="TxtEndDate" CssClass="pull-right"></asp:TextBox>
                                </td>

                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Button runat="server" ID="BtnUpdateData" Text="update" CssClass="calendar-submit" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!-- box 1 -->
    <div class="row-fluid">
        <!-- box follower map -->
        <asp:UpdatePanel ID="UpPCharMap" runat="server" UpdateMode="Conditional" class="follower-map">
            <ContentTemplate>
                <div class="top-bar">
                    followers map <span class="mapfound">(found
                        <asp:Label runat="server" ID="LblMapCount"></asp:Label>)</span>
                    <div>
                        <asp:LinkButton runat="server" ID="LnkResetMap" CssClass="a-icona6 tooltip" title="Reset map"></asp:LinkButton>
                        <%--<a href="#" class="a-icona6 tooltip" id="map_reset_world" title="Reset map"></a>--%>
                    </div>
                </div>
                <div class="well">
                    <div id="chart_map_country" class="body" style="height: 400px; overflow: hidden;">
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>

    </div>

    <!-- box 2 -->
    <div class="row-fluid">
        <!-- box followers-activity -->
        <asp:UpdatePanel ID="UpPCharActivity" runat="server" UpdateMode="Conditional" class="followers-activity">
            <ContentTemplate>
                <div class="top-bar">
                    followers activity
                    <div>
                        <a href="#" class="a-icona7 tooltip" title="Indicates in which hours your followers are most active (number of posts per hour)."></a>
                    </div>
                </div>
                <div class="well-activity">
                    <div id="chart_foll_act_div" style="height: 110px; width: 500px; overflow: hidden;">
                    </div>
                    <div id="chart_foll_count" style="height: 110px; width: 500px; overflow: hidden;">
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>

        <!-- box peolpe -->
        <asp:UpdatePanel ID="UpPGender" runat="server" UpdateMode="Conditional" class="people">
            <ContentTemplate>
                <div class="top-bar">
                    <table width="100%">
                        <tr>
                            <td width="50%">people</td>
                            <td>languages</td>
                            <td>
                                <div><a href="#" class="a-icona7 tooltip" title="People: percentage of analyzed followers that are companies or professionals; gender of analyzed followers.<br>Languages: top 4 languages of your followers."></a></div>
                            </td>
                        </tr>
                    </table>

                </div>
                <div class="well-people">
                    <div class="people-first">

                        <img src="/style/app/img/persone.png" />
                    </div>
                    <div class="people-sec">
                        <div class="business">
                            <asp:Label runat="server" ID="LblBusinessPerc" />
                        </div>
                        <div class="male">
                            <asp:Label runat="server" ID="LblMalePerc" />
                        </div>
                        <div class="fame">
                            <asp:Label runat="server" ID="LblFemalePerc" />
                        </div>
                    </div>
                    <div class="people-th">
                        <img src="/style/app/img/icone.png" />
                    </div>
                    <div class="people-four">
                        <div id="chart_div_language" style="height: 180px; width: 180px; overflow: hidden;"></div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!-- box 3 -->
    <div class="row-fluid">
        <!-- box followers status -->
        <asp:UpdatePanel ID="UpPStatus" runat="server" UpdateMode="Conditional" class="followers-status-per-day">
            <ContentTemplate>
                <div class="top-bar">
                    followers status per day
                    <div><a href="#" class="a-icona7 tooltip" title="Activity analysis of your followers in the selected date range."></a></div>
                </div>
                <div class="well-status-per-day">
                    <div id="chart_div_status" style="height: 220px; width: 500px; overflow: hidden;">
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>

        <!-- box peolpe -->
        <div class="followers">
            <div class="top-bar">
                followers activity
                <div>
                    <a href="#" class="a-icona7 tooltip" title="Activity analysis of your followers."></a>
                </div>
            </div>
            <div class="well-followers">
                <div>
                    <div class="fake-followers">
                        <div class="fake-title">fake</div>
                        <div class="fake-img">
                            <img src="/style/app/img/fake.png" />
                        </div>
                        <div class="fake-perc">
                            <asp:Label runat="server" ID="LblStatusFake" />
                        </div>
                    </div>
                    <div class="inactive-followers">
                        <div class="inactive-title">inactive</div>
                        <div class="inactive-img">
                            <img src="/style/app/img/inactive.png" />
                        </div>
                        <div class="inactive-perc">
                            <asp:Label runat="server" ID="LblStatusInactive" />
                        </div>
                    </div>
                    <div class="good-followers">
                        <div class="good-title">good</div>
                        <div class="good-img">
                            <img src="/style/app/img/good.png" />
                        </div>
                        <div class="good-perc">
                            <asp:Label runat="server" ID="LblStatusGood" />
                        </div>
                        <div class="good-perc-high">
                            <div>
                                <div class="perc-good">
                                    <asp:Label runat="server" ID="LblStatusHigh" />
                                </div>
                                <div class="desc-good">high</div>
                            </div>
                        </div>
                        <div class="good-perc-medium">
                            <div>
                                <div class="perc-good">
                                    <asp:Label runat="server" ID="LblStatusMedium" />
                                </div>
                                <div class="desc-good">medium</div>
                            </div>
                        </div>
                        <div class="good-perc-low">
                            <div>
                                <div class="perc-good">
                                    <asp:Label runat="server" ID="LblStatusLow" />
                                </div>
                                <div class="desc-good">low</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


    </div>

    <!-- box 4 -->
    <div class="row-fluid">
        <!-- box message -->
        <asp:UpdatePanel ID="UpPImpression" class="contenitore-div" runat="server" UpdateMode="Conditional" Visible="True">
            <ContentTemplate>
                <div class="mentions">

                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblEngagementCount" CssClass="num-titolo" />message through
                            </div>
                            <div class="titolo-dx">
                                <asp:Label runat="server" ID="LblEngagementAvg" CssClass="num-titolo" />message through/day
                            </div>
                            <div class="titolo-ico"><a href="#" class="a-icona7 tooltip" title="Impressions: number of potential users reached with your communication in the selected date range. Message throught: number of potential users reached with your communication and not directly connected to your account (a.k.a. potential new customers)."></a></div>
                        </div>
                    </div>
                    <div class="well-mentions">
                        <div id="chart_div_engag" style="height: 220px; width: 500px; overflow: hidden;">
                        </div>
                    </div>
                </div>
                <div class="sent-posts" >
                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblImpressionCount" CssClass="num-titolo" />impressions
                            </div>
                            <div class="titolo-dx">
                                <asp:Label runat="server" ID="LblImpressionAvg" CssClass="num-titolo" />impressions/day
                            </div>
                            <div class="titolo-ico"><a href="#" class="a-icona7 tooltip" title="Impressions: number of potential users reached with your communication in the selected date range. Message throught: number of potential users reached with your communication and not directly connected to your account (a.k.a. potential new customers)."></a></div>
                        </div>
                    </div>
                    <div class="well-sent">
                        <div id="chart_div_impress" style="height: 220px; width: 500px; overflow: hidden;">
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>

        <!-- box unique -->
        <asp:UpdatePanel ID="UpPUniqueInter" runat="server" UpdateMode="Conditional" class="retweeted">
            <ContentTemplate>
                <!-- titolo -->
                <div class="top-bar">
                    <asp:Label runat="server" ID="LblUniqueInter" class="num-titolo"></asp:Label>
                    unique interactions by
                    <div><a href="#" class="a-icona7 tooltip" title="Unique users per day that has mentioned, retweeted or replied to your posts."></a></div>
                </div>
                <!-- contenuti -->
                <div class="well-ret">
                    <asp:ListView ID="ListUniqueInter" runat="server" ClientIDMode="Predictable">
                        <ItemTemplate>
                            <div class="post">
                                <div class="icona-unique">
                                    <asp:HyperLink runat="server" NavigateUrl='<%# eval("url") %>' Target="_blank">
                                            <img src="<%# eval("avatar") %>"  />
                                    </asp:HyperLink>
                                </div>
                                <div class="content-tweet">
                                    <div class="titolo-count"><%# eval("fullname") %><span class="weevo">@<%# Eval("username")%></span></div>
                                    <div class="testo-count"><%# Mid(eval("description").ToString,1,50)   %></div>
                                    <div class="ref-count">
                                        <%# eval("location") %> - <a href="#" class="weevo-link" target="_blank">website</a>
                                    </div>
                                </div>
                                <div class="counter-tweet">
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(eval("post_count")) %></div>
                                        <div class="counter-t">TWEETS</div>
                                    </div>
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(Eval("friend_count"))%></div>
                                        <div class="counter-t">FOLLOWING</div>
                                    </div>
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(Eval("follower_count"))%></div>
                                        <div class="counter-t">FOLLOWERS</div>
                                    </div>
                                </div>
                                <div class="ok-dm">
                                    <div>
                                        <asp:LinkButton runat="server" CssClass="a-icona1 tooltip" title="Follow/unfollow this user" ID="BtnFollow" CommandArgument='<%# eval("account_code") %>' CommandName="FOLLOW" Text="" />
                                    </div>
                                    <div>
                                        <asp:Label runat="server" ID="LblFollower" CssClass="a-icona2 tooltip" Text="" title="If active, this user is following you"></asp:Label>
                                    </div>
                                    <div>
                                        <asp:LinkButton runat="server" ID="BtnOpenPrivate" CssClass="a-icona3 tooltip" OnClientClick="Open_Private_Message(this);" CommandName="OPEN_PRIVATE"></asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </ItemTemplate>
                    </asp:ListView>
                    <App:DataPager runat="server" Controlid="ListUniqueInter" PageSize="7" OnPageChanged="SetListInterractionAccount" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>

    </div>

    <!-- box 5 -->
    <div class="row-fluid">
        <!-- box mentions -->
        <asp:UpdatePanel ID="UpPChar2" runat="server" UpdateMode="Conditional" class="contenitore-div">
            <ContentTemplate>
                <div class="mentions">
                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblMessageCount" CssClass="num-titolo" />
                                mentions
                            </div>
                            <div class="titolo-dx">
                                <asp:Label runat="server" ID="LblShareCount" CssClass="num-titolo" />
                                retweets
                            </div>
                            <div class="titolo-ico">
                                <div><a href="#" class="a-icona7 tooltip" title="Mentions and retweets per day, in the selected date range."></a></div>
                            </div>
                        </div>
                    </div>
                    <div class="well-mentions">
                        <div id="chart_div" style="height: 220px; width: 500px; overflow: hidden;">
                        </div>

                    </div>
                </div>

                <!-- box sent-posts -->
                <div class="sent-posts">
                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblPostCount" CssClass="num-titolo" />
                                sent post
                            </div>
                            <div class="titolo-dx">
                                <asp:Label runat="server" ID="LblPostAvg" CssClass="num-titolo" />
                                post/day
                            </div>
                            <div class="titolo-ico">
                                <div><a href="#" class="a-icona7 tooltip" title="Sent post in the selected date range; average post per day."></a></div>
                            </div>
                        </div>
                    </div>
                    <div class="well-sent">
                        <div id="chart_div_post_send" style="height: 220px; width: 500px; overflow: hidden;">
                        </div>
                    </div>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>

        <!-- box retweeted -->
        <asp:UpdatePanel ID="UpPSharePost" runat="server" UpdateMode="Conditional" class="retweeted">
            <ContentTemplate>
                <div class="top-bar">
                    <asp:Label runat="server" ID="LblSharePost" CssClass="num-titolo"></asp:Label>
                    retweeted posts
                    <div><a href="#" class="a-icona7 tooltip" title="Most retweeted posts in the selected date range."></a></div>
                    <div><a href="#LISTEN" class="a-icona8 tooltip link_to" title="Look at this in the Listen panel"></a></div>
                </div>
                <div class="well-ret">
                    <asp:ListView ID="ListSharePosts" runat="server" ClientIDMode="Predictable">
                        <ItemTemplate>
                            <div class="post">
                                <div style="height: 40px;"><%# MyUI.Print.Post(Eval("Post_Text"))%></div>
                                <div style="height: 27px; line-height: 27px">
                                    <div class="dt-post">posted on <%# MyUI.Print.DateTimeLong2(Eval("pubb_date").value)%></div>
                                    <div class="tm-post">retweeted<%# Eval("share_count")%>times</div>
                                </div>
                            </div>
                        </ItemTemplate>
                    </asp:ListView>
                    <App:DataPager runat="server" Controlid="ListSharePosts" PageSize="7" OnPageChanged="SetListSharePost" />

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!-- box 6 -->
    <div class="row-fluid">
        <asp:UpdatePanel ID="UpPChar4" runat="server" UpdateMode="Conditional" class="contenitore-div">
            <ContentTemplate>
                <!-- box new-followers -->
                <div class="new-followers">
                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblFollowersCount" CssClass="num-titolo" />
                                followers
                            </div>
                            <div class="titolo-dx">
                                <asp:Label runat="server" ID="LblFollowersAvg" CssClass="num-titolo" />
                                followers/day
                            </div>
                            <div class="titolo-ico">
                                <div><a href="#" class="a-icona7 tooltip" title="Acquired followers in the selected date range; average acquired followers per day."></a></div>
                            </div>
                        </div>
                    </div>
                    <div class="well-new">
                        <div id="chart_div_follower" style="height: 220px; width: 500px; overflow: hidden;"></div>
                    </div>
                </div>

                <!-- box new-following -->
                <div class="new-following">
                    <div class="top-bar">
                        <div style="width: 100%;">
                            <div class="titolo-sx">
                                <asp:Label runat="server" ID="LblAutoFollAccount" CssClass="num-titolo" />
                                new followings
                            </div>
                            <div class="titolo-dxc">
                                <asp:Label runat="server" ID="LblAutoFollBecFoll" CssClass="num-titolo" />
                                follow back

                            </div>
                            <div class="titolo-dxc">
                                <asp:Label runat="server" ID="LblAutoFollUnFoll" CssClass="num-titolo" />
                                unfollows
                            </div>
                            <div class="titolo-ico">
                                <div><a href="#" class="a-icona7 tooltip" title="Auto-following tool: number of new following, number of follow back, number of auto unfollows, in the selected date range."></a></div>
                            </div>
                        </div>
                    </div>
                    <div class="well-following">
                        <div id="chart_auto_foll_div" style="height: 220px; width: 500px; overflow: hidden;">
                        </div>
                    </div>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>

        <!-- box follow back -->
        <asp:UpdatePanel ID="UpPNewFoll" runat="server" UpdateMode="Conditional" class="follow-back">
            <ContentTemplate>
                <div class="top-bar">
                    <asp:Label runat="server" ID="LblUpPNewFoll" CssClass="num-titolo"></asp:Label>follow back
                    <div><a href="#" class="a-icona7 tooltip" title="Acquired followers in the selected date range; average acquired followers per day."></a></div>
                    <div><a href="/App/FollowersList.aspx#FollowersList" class="a-icona9 tooltip" title="Look at this in the Connections panel"></a></div>
                </div>
                <div class="well-back">
                    <%--                    <asp:GridView ID="GridNewFollUsers" runat="server" ShowHeader="false" CssClass="tb-post" AutoGenerateColumns="False" AllowSorting="true" GridLines="None">
                    </asp:GridView>--%>
                    <asp:ListView ID="ListNewFollUsers" runat="server" ClientIDMode="Predictable">
                        <ItemTemplate>
                            <div class="post">
                                <div class="icona-unique">
                                    <asp:HyperLink runat="server" NavigateUrl='<%# eval("url") %>' Target="_blank">
                                            <img src="<%# eval("avatar") %>"  />
                                    </asp:HyperLink>
                                </div>
                                <div class="content-tweet">
                                    <div class="titolo-count"><%# eval("fullname") %><span class="weevo">@<%# Eval("username")%></span></div>
                                    <div class="testo-count"><%# Mid(eval("description").ToString,1,50)   %></div>
                                    <div class="ref-count">
                                        <%# eval("location") %> - <a href="#" class="weevo-link" target="_blank">website</a>
                                        <span class="weevo"><%# Eval("source")%></span>
                                    </div>
                                </div>
                                <div class="counter-tweet">
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(eval("post_count")) %></div>
                                        <div class="counter-t">TWEETS</div>
                                    </div>
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(Eval("friend_count"))%></div>
                                        <div class="counter-t">FOLLOWING</div>
                                    </div>
                                    <div class="count">
                                        <div class="counter-n"><%# UI.Print.Num0(Eval("follower_count"))%></div>
                                        <div class="counter-t">FOLLOWERS</div>
                                    </div>
                                </div>
                                <div class="ok-dm">
                                    <div>
                                        <asp:LinkButton runat="server" CssClass="a-icona1 tooltip" title="Follow/unfollow this user" ID="BtnFollow" CommandArgument='<%# eval("account_code") %>' CommandName="FOLLOW" Text="" />
                                    </div>
                                    <div>
                                        <asp:Label runat="server" ID="LblFollower" CssClass="a-icona2 tooltip" Text="" title="If active, this user is following you"></asp:Label>
                                    </div>
                                    <div>
                                        <asp:LinkButton runat="server" ID="BtnOpenPrivate" CssClass="a-icona3 tooltip" OnClientClick="Open_Private_Message(this);" CommandName="OPEN_PRIVATE"></asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </ItemTemplate>

                    </asp:ListView>

                    <App:DataPager runat="server" Controlid="ListNewFollUsers" PageSize="7" OnPageChanged="SetListNewFollowerAccount" />

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>



    <script type="text/javascript">

        $(function () {


        });


        function Open_PostWrite_Message(o) {
            Open_Layer({
                layer: send_post,
                attach: function () {
                    $('#' + o.id).closest(".mention").after(send_post);
                }
            });
        }

        function Open_Private_Message(o) {
            Open_Layer({
                layer: private_message,
                attach: function () {
                    private_message.position({ my: "right top", at: "right bottom+5", of: '#' + o.id });
                    ScrollDown($('.ListPrivateMess'));
                }
            });
        }
        //function Open_PostWrite_Message(o) {

        //    $('#main_container').append(send_post);

        //    on_update_panel_server_once(function () {
        //        //alert($('#' + o.id).parent("#CphMainContent_ListMessage_UpPMessageRow_2"));
        //        send_post.hide();
        //        send_post.fadeIn();
        //        //ff.position({ my: "left top", at: "left bottom", of: '#' + o.id });
        //        //$("#CphMainContent_ListMessage_UpPMessageRow_2").append(ff);
        //        $('#' + o.id).closest(".mention").after(send_post);
        //        //$('#' + o.id).parent().parent().parent().parent().parent().parent().append(ff);

        //    });
        //}

        //function Open_Private_Message(o) {

        //    $('#main_container').append(send_post);

        //    on_update_panel_server_once(function () {
        //        private_message.hide();
        //        private_message.fadeIn();
        //        //$('#' + o.id).closest(".post").append(private_message);
        //        private_message.position({ my: "right top", at: "right bottom+5", of: '#' + o.id });

        //        $('.ListPrivateMess').scrollTop($('.ListPrivateMess')[0].scrollHeight);
        //    });
        //}

    </script>

</asp:Content>
